import axios from "axios";

export default {
  // 开启命名空间
  namespaced: true,
  state: {
    car: [1, 2, 3, 4],
  },
  mutations: {
    setCar(state, payload) {
      state.car = payload;
    },
  },
  actions: {
    async fetchCar({ commit }) {
      const resp = await axios.get("/api/car");
      commit("setCar", resp.data.data);
    },
  },
};
